<?php

if(!function_exists('obj_urlencode')){
    function obj_urlencode($obj){
        if(!$obj){
            return '';
        }
        var_dump($obj);
        $newobj=new stdClass();
        foreach($obj as $key=>$val){
            if(is_array($val)){
                $newobj->$key=array_urlencode($val);
            }elseif(is_object($val)){
                $newobj->$key=obj_urlencode($val);
            }else{
                $newobj->$key=urlencode($val);
            }
        }
        return $newobj;
    }
}

if(!function_exists('array_urlencode')){
function array_urlencode($data){
    $new_data = array();
    foreach($data as $key => $val){
        // 这里我对键也进行了urlencode
        $new_data[urlencode($key)] = is_array($val) ? array_urlencode($val) : urlencode($val);
    }
    return $new_data;
}
}

